/** JSON.stringify(proxyInstance)*/

/** case1: obj*/
/*
const o = {a: 1, b: 2};

const p = new Proxy(o, {
  get(target, key) {
    console.log('target:',target,'key:',key);

    return target[key]
  }
});

JSON.stringify(p)
/!*
target:{a: 1, b: 2},key:toJSON
target:{a: 1, b: 2},key:a
target:{a: 1, b: 2},key:b
*!/
*/

/** case2: arr*/
const o = [1,2,3];

const p = new Proxy(o, {
  get(target, key) {
    console.log('target:',target,'key:',key);

    return target[key]
  }
});

JSON.stringify(p)
/*
target: [ 1, 2, 3 ] key: toJSON
target: [ 1, 2, 3 ] key: length
target: [ 1, 2, 3 ] key: 0
target: [ 1, 2, 3 ] key: 1
target: [ 1, 2, 3 ] key: 2
*/
